package com.yupi.makegroup.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yupi.makegroup.model.User;
import com.baomidou.mybatisplus.extension.service.IService;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author 51230
 * @description 针对表【user(用户表)】的数据库操作Service
 * @createDate 2025-08-31 11:44:22
 */
public interface UserService extends IService<User> {
    /**
     * 用户注册
     *
     * @param userAccount   用户账户
     * @param userPassword  用户密码
     * @param checkPassword 校验密码
     * @param planetCode    星球编号
     * @return 返回id
     */
    long userRegister(String userAccount, String userPassword, String checkPassword, String planetCode);

    User doLogin(String userAccount, String userPassword, HttpServletRequest request);

    /**
     * 用户脱敏
     *
     * @param user 原用户
     * @return 脱敏后的用户
     * @author CFS
     */
    User getSafeUser(User user);

    /**
     * 用户注销
     *
     * @return 1-注销成功
     * @Param request 请求
     */
    int userLogout(HttpServletRequest request);

    List<User> searchUsersByTags(List<String> tagNameList);

    User getLoginUser(HttpServletRequest request);

    int updateUser(User user, User loginUser);

    boolean isAdmin(HttpServletRequest request);

    boolean isAdmin(User user);

    Page<User> getRecommendUsers(long pageNum, long pageSize, HttpServletRequest request);

    /**
     * 推荐匹配
     *
     * @param num   推荐数量
     * @param user  当前用户
     * @return 推荐用户列表
     */
    List<User> matchUsers(long num, User user);
}
